package com.ywyself.controller.api;

import java.util.List;
import java.util.Map;

import com.jfinal.core.ActionKey;
import com.ywyself.common.pool.DataPool;
import com.ywyself.controller.base.YsController;
import com.ywyself.ext.kit.YsKit;
import com.ywyself.service.CatelogService;

public class ApiCatelogController extends YsController {

	@ActionKey("/api/catelog")
	public void catelog() {
		forwardAction("/api/catelog/list");
	}

	@ActionKey("/api/catelog/list")
	public void catelog_list() {
		List<Map<String, Object>> listRecordsCatelogs = CatelogService.EXC.listPageApi(1, DataPool.getPageSize());
		if (listRecordsCatelogs.size() > 0) {
			YsKit.ok().msg("获取数据成功").set("count", listRecordsCatelogs.size()).data(listRecordsCatelogs).render(this);
		} else {
			YsKit.fail().msg("没有获取到数据").render(this);
		}
	}
}
